class Solution:
    def lengthOfLongestSubstring(self, s: str) -> int:
        nmax = 0
        n = 0
        for n in range(len(s)):
            s1 = ''
            for i in s[n:]:
                if i in s1:
                    break
                else:
                    s1 = s1 + i
            nmax = max(len(s1), nmax)
        return nmax